Beyond the Basic Stuff with Python: Best Practices for Writing Clean Code

Beyond the Basic Stuff with Python: Best Practices for Writing Clean Code

  • Downloads:4385
  • Type:Epub+TxT+PDF+Mobi
  • Create Date:2021-09-26 08:53:07
  • Update Date:2025-09-07
  • Status:finish
  • Author:Al Sweigart
  • ISBN:1593279663
  • Environment:PC/Android/iPhone/iPad/Kindle

Summary

BRIDGE THE GAP BETWEEN NOVICE AND PROFESSIONAL

You've completed a basic Python programming tutorial or finished Al Sweigart's bestseller, Automate the Boring Stuff with Python。 What's the next step toward becoming a capable, confident software developer?

Welcome to Beyond the Basic Stuff with Python。 More than a mere collection of advanced syntax and masterful tips for writing clean code, you'll learn how to advance your Python programming skills by using the command line and other professional tools like code formatters, type checkers, linters, and version control。 Sweigart takes you through best practices for setting up your development environment, naming variables, and improving readability, then tackles documentation, organization and performance measurement, as well as object-oriented design and the Big-O algorithm analysis commonly used in coding interviews。 The skills you learn will boost your ability to program--not just in Python but in any language。

You'll learn:
- Coding style, and how to use Python's Black auto-formatting tool for cleaner code
- Common sources of bugs, and how to detect them with static analyzers
- How to structure the files in your code projects with the Cookiecutter template tool
- Functional programming techniques like lambda and higher-order functions
- How to profile the speed of your code with Python's built-in timeit and cProfile modules
- The computer science behind Big-O algorithm analysis
- How to make your comments and docstrings informative, and how often to write them
- How to create classes in object-oriented programming, and why they're used to organize code

Toward the end of the book you'll read a detailed source-code breakdown of two classic command-line games, the Tower of Hanoi (a logic puzzle) and Four-in-a-Row (a two-player tile-dropping game), and a breakdown of how their code follows the book's best practices。 You'll test your skills by implementing the program yourself。

Of course, no single book can make you a professional software developer。 But Beyond the Basic Stuff with Python will get you further down that path and make you a better programmer, as you learn to write readable code that's easy to debug and perfectly Pythonic

Requirements: Covers Python 3。6 and higher

Download

Reviews

Johan

It covers a lot of topics that go beyond the basic python stuff, and it explains them well。However, this was not the right book for me right now。 I should make projects or experiment, but not read one book after another。 I will probably come back to this book in the future。

Vincent

Quite good, an effective way to get where the title suggests you're going to get。 I expect having read this book will help me write better Python code in the future, and understand a few things I didn't understand before, and that's really all I wanted from it。 It also gave several suggestions for further reading, some of which I added to my to-read list so that I may improve further。 Quite good, an effective way to get where the title suggests you're going to get。 I expect having read this book will help me write better Python code in the future, and understand a few things I didn't understand before, and that's really all I wanted from it。 It also gave several suggestions for further reading, some of which I added to my to-read list so that I may improve further。 。。。more

David

This is the next steps book I needed after "Automate the Boring Stuff"! This takes you beyond writing basic code and scripting tasks, dealing with code management, documentation, typehinting, and moving through more complex Object Orientated Programming (OOP) ideas。 Also included is some troubleshooting and code smell guidance and common python idiosyncrasies that tripped me up when I was learning。 Even though I'm past the target audience for this book, I'll specifically be referring back to a c This is the next steps book I needed after "Automate the Boring Stuff"! This takes you beyond writing basic code and scripting tasks, dealing with code management, documentation, typehinting, and moving through more complex Object Orientated Programming (OOP) ideas。 Also included is some troubleshooting and code smell guidance and common python idiosyncrasies that tripped me up when I was learning。 Even though I'm past the target audience for this book, I'll specifically be referring back to a couple of sections, in particular the OOP composition/inheritance portion。 It is clear and concise, with good guidance on tradeoffs between different approaches。 。。。more

Ricky Macharm

Al Sweigart has taken us from automating boring stuff, to breaking codes and also inventing games all in Python。 Now he is taking us beyond all the basic stuff to mastering this beautiful language。First of all, if you are not familiar with his work before this, I want you to know that his delivery is excellent and all his books are page turners。 You can read them like a novel (which I do a lot) but you will need to get your hands dirty with code too。This book takes you further into how to write Al Sweigart has taken us from automating boring stuff, to breaking codes and also inventing games all in Python。 Now he is taking us beyond all the basic stuff to mastering this beautiful language。First of all, if you are not familiar with his work before this, I want you to know that his delivery is excellent and all his books are page turners。 You can read them like a novel (which I do a lot) but you will need to get your hands dirty with code too。This book takes you further into how to write clean and pythonic code。 If you understand what he is teaching here, you should be able to make contributions to open-source projects on Github。 Since I am into Finance and Engineering, I love the examples he gave (under the OOP section) on bank accounts。 He also broke down reasons why enumerate() should be used in place of range() and many other examples I can not list here。This is one book I am going to spend my leave studying as both a user and teacher of Python。 。。。more

Justin

Has one of the better explanations of Big O analysis that I've seen in a Python book。 Has one of the better explanations of Big O analysis that I've seen in a Python book。 。。。more

Alvee

Loved this book! Al does a superb job of going over some of the most practical knowledge that you'll be able to use as a Python developer。This book bridges the gap between books like Python Crash Course and Fluent Python。If you understand your basics of Python (have done an intro course and/or a couple of projects) give this one a read。 Loved this book! Al does a superb job of going over some of the most practical knowledge that you'll be able to use as a Python developer。This book bridges the gap between books like Python Crash Course and Fluent Python。If you understand your basics of Python (have done an intro course and/or a couple of projects) give this one a read。 。。。more

Ian Mizer

Review of “Beyond the Basic Stuff with Python”By Ian MizertI was given this book by No Starch Press, but the thoughts in this review are my owntThis is the kind of book every python developer can use and every developer should buy。 This book tries to teach the readers the fundamentals of python and writing code in general。 Almost all of this book will be useful during the entire run of python 3 and some of this book will still be worth it's pages for the python 4 future。 This book covers several Review of “Beyond the Basic Stuff with Python”By Ian MizertI was given this book by No Starch Press, but the thoughts in this review are my owntThis is the kind of book every python developer can use and every developer should buy。 This book tries to teach the readers the fundamentals of python and writing code in general。 Almost all of this book will be useful during the entire run of python 3 and some of this book will still be worth it's pages for the python 4 future。 This book covers several incredibly important topics like organizing a git, understanding code smells, how to ask good questions on stack overflow, and common python gotchas 。 The author also goes to great length to teach the reader about a lot of what's going on under the hood when you call certain things in python like looping with python and how it's calling iter and next to actually execute the loop。 While each chapter is useful it also keeps itself brief, usually not going farther than 20 pages per chapter。 All in all I cannot recommend “Beyond the Basic Stuff with Python” enough for every person who wants to learn fundamentals surrounding coding and specifically coding in python。ttReadability : How easy would it be for someone to sit down with this book and finish it quickly。 tAccuracy : How accurate is the information being given? Could you write every single line of code in this book and have the books answers match the code you wrote。 Normally this is a -1 out of 10 per major mistake and per 4 minor mistakes the book makestSubject : Does this book do what it wants to do and is what it wants to do good? tBonus points: for extra stuff that I liked。 This will be the most subjective part of the review and might not go into much detail。 It's just little things that I highly enjoyed and wanted to give a shoutout abouttReadability 10/10:tI finished this book in 9 days reading 20-60 pages a day。 The book is very quickly digestible as most of it doesn't require you to sit down and write code。 In fact half of the chapters require you to do nothing at all and instead understand the fundamentals of python。 Because of this a person can get through the book incredibly quickly, only stopping or slowing down during the sessions were they check the libraries given or try setting up some of the libraries and git actions that the book teaches you。tAccuracy 10/10:tThere were no errors that I could find that actually affected the reader。 Just a minor one at the start of the book。 The publisher will probably have fixed it by the time you see this review。tSubject 10/10:tBecause it is very difficult for the words in this book to lose value I can say that the subjects covered here are the most important subjects that any reader would want to know。 What this book wants to teach is very durable to time and as I said at the start of this review, all of this book is useful across the entire python 3 ecosystem and will mostly be useful across any future python 4 ecosystems。 Especially since it covers git and stack overflow topics。 I would say that the only things that won't stand the test of time is when it informs the reader of certain libraries like timeit, cprofiler, and black。 Most of those libraries are considered essential to understanding or formatting your code so even then it's going to be difficult to say that any of them will fall out of style anytime soon。 Since this is a fundamentals book on par with testing basics or understanding OOP I can't recommend this book enough to every python user。ttBonus Points:tt+1 for brevity:tThis book covers a lot of subjects and I think the author does amazingly well at making sure there is no wasted space。 The author covers the basic that he needs to and doesn't try to get you to do an example at the end of every chapter and I think that makes it more easily digestible to people who will already know certain chapters。 All in all a great read t+1 for doing a good job at being timeless:tAs I said earlier in this review, this book will last a really long time。 It might still be good after 10 years and not many books in this field could ever say that。 This is because it's covering a lot of what needs to go on behind the scenes and under the hood in the python language。 Teaching what double underscores are doing or what some of the python gotchas are lasts a really long time。 It will definitely last through the entire life cycle of python 3。 So kudost 。。。more

Simeon Franklin

"Beyond the Basic Stuff with Python" covers a variety of topics that are frequent stumbling blocks for folks relatively new to Python or inexperienced with software development in general。 This isn't for absolute beginners - if you can't write a for-loop yet look elsewherefirst。 But for folks getting to the the "advanced novice" stage this is a fantastic resource。For context: I often teach classes for novice Python programmers through community events。 Participants might be scientists or statist "Beyond the Basic Stuff with Python" covers a variety of topics that are frequent stumbling blocks for folks relatively new to Python or inexperienced with software development in general。 This isn't for absolute beginners - if you can't write a for-loop yet look elsewherefirst。 But for folks getting to the the "advanced novice" stage this is a fantastic resource。For context: I often teach classes for novice Python programmers through community events。 Participants might be scientists or statisticians trying to improve their Python chops or programming bootcamp students who are relatively new to writing code。Often their code works - sort of。 They are beyond the basics of syntax but struggling with software development skills: It runs in a notebook but I don't know how to run it with out starting a notebook server。。。 I commented out this block of code because I only need it the first time I run this。。。 How do I get rid of all the numbered indexes like row[3][2]? Is there a way to make this less repetitive?Al Sweigart does a great job of choosing topics that often come up from these folks and they aren't limited to Python syntax and semantics。 This book covers many issues specific to Python like using the Black code formatter, writing Pythonic code, some Python language gotchas and idiosyncrasies and even coverage of writing object oriented code with Python。But this isn't just a Python tutorial。 It also covers some common topics that are familiar to folks with a computer science background but otherwise might be mysterious。 From defining jargon like "mutability" or "garbage collection" to explaining Big O analysis of algorithms or the chapter on using Git effectively to manage your personal projects - there are lots of gems to help grow novice programmers into software developers。I have often recommended "Automate the Boring Stuff With Python" as way to get absolute beginners to jump into writing some code that hopefully scratches an itch and motivates them to continue learning。 I'll be recommending this book to those learners who want to keep growing in the craft of software development with Python。 。。。more

Linda

“How to Automate the Boring Stuff” is a book I frequently tend to recommend to newcomers to programming, so it was a pleasant surprise to hear about this new book, which I can now enthusiastically recommend as a sequel。 :) This book covers everything a beginner needs to know to get to the next level of becoming a software developer, and answers a lot of questions beginners might not even _know_ to ask— like common Python gotchas, programming jargon that might be confusing, how to navigate the co “How to Automate the Boring Stuff” is a book I frequently tend to recommend to newcomers to programming, so it was a pleasant surprise to hear about this new book, which I can now enthusiastically recommend as a sequel。 :) This book covers everything a beginner needs to know to get to the next level of becoming a software developer, and answers a lot of questions beginners might not even _know_ to ask— like common Python gotchas, programming jargon that might be confusing, how to navigate the command line, how to use version control, and how to interpret error messages。 It also contains a lot of tips specific to writing better / more Pythonic code, which I was pleased to find。 My favorite chapters:Chapter 1: Dealing with Errors and Asking for Help — very practical/useful tips in here; short and sweetChapter 8: Common Python GotchasChapter 15: Object-Oriented Programming and ClassesI highly recommend reading this book with a friend or study partner so you can discuss each chapter together! 。。。more

Jonathan Hartley

This book is a brilliant "next step" for people who are learning the Python programming language。 If you've read a book or some tutorials about the language itself, or are writing your first programs, then this book is for you。 It will expand your awareness of the sort of things you ought to know about, beyond the basics of the Python language itself。It collects together wisdom from a wide range of topics, such as characterizing good code versus bad, the absolute bare minimum nuggets extracted f This book is a brilliant "next step" for people who are learning the Python programming language。 If you've read a book or some tutorials about the language itself, or are writing your first programs, then this book is for you。 It will expand your awareness of the sort of things you ought to know about, beyond the basics of the Python language itself。It collects together wisdom from a wide range of topics, such as characterizing good code versus bad, the absolute bare minimum nuggets extracted from a computer science degree that you really might need from time to time (presented very approachably), and introductions to common tools from the Python ecosystem, like the code formatter "Black", or source control with "Git", and why you might want to get to grips with them。 Many other topics are covered - see the contents:PART 1: GETTING STARTEDChapter 1: Dealing with Errors and Asking for HelpChapter 2: Environment Setup and the Command LinePART 2: BEST PRACTICES, TOOLS, AND TECHNIQUESChapter 3: Code Formatting with BlackChapter 4: Choosing Understandable NamesChapter 5: Finding Code SmellsChapter 6: Writing Pythonic CodeChapter 7: Programming JargonChapter 8: Common Python GotchasChapter 9: Esoteric Python OdditiesChapter 10: Writing Effective FunctionsChapter 11: Comments, Docstrings, and Type HintsChapter 12: Organizing Your Code Projects with GitChapter 13: Measuring Performance and Big O Algorithm AnalysisChapter 14: Practice ProjectsPART 3: OBJECT-ORIENTED PYTHONChapter 15: Object-Oriented Programming and ClassesChapter 16: Object-Oriented Programming and InheritanceChapter 17: Pythonic OOP: Properties and Dunder MethodsExperienced programmers won't find anything new here, which in itself is a testament to how each of the topics presented really are foundational to becoming a better programmer。For everyone else, this is a sensible guided tour, written in straightforward, demystifying text, that will improve all the programming you do from this point on。 Read this book, and add computer programming to your skill set。The Python community is booming, friendly, and diverse, and includes people from all walks of life, from academics, hobbyist game developers, cutting-edge machine-learning and data-scientist people, commercial folks who build websites and online services, and all sorts of people who just want to get something done, quickly and easily。 Welcome aboard - we're very glad to have you。 。。。more

Lucas Sapucahy

Al Sweigart knows how python works, but it took him years and years to know all that he knows, and in this book, Beyond the Basic Stuff with Python, Al presents to us all the gotchas, all the pits and weird turns that will show on your way with this neat little language。 His approach to teaching not just the language but the tools necessary to use it properly and all its idiosyncrasies makes this a must read for developer new in python, or just a junior developer, oh who am I kidding? I have 5 y Al Sweigart knows how python works, but it took him years and years to know all that he knows, and in this book, Beyond the Basic Stuff with Python, Al presents to us all the gotchas, all the pits and weird turns that will show on your way with this neat little language。 His approach to teaching not just the language but the tools necessary to use it properly and all its idiosyncrasies makes this a must read for developer new in python, or just a junior developer, oh who am I kidding? I have 5 years of experience using python in production, but his book taught me a lot about the python interpreter, how to find code smells in python code without the use of static analysis tools, and his chapter in benchmark helped me and my team to develop new non-invasive ways to monitor and benchmark methods。 。。。more

Catherine Devlin

I love this book! The world is awash in Python introductions, but for the next step - from understanding Python in principle to using it in practical actual projects - there aren't so many good options, especially ones that keep an empathic learning curve。You can really see the experience the author brings from all of his teaching, paying excellent attention to what trips them up and to what common materials forget to teach。 He's avoided the "curse of knowledge" that makes too many experts forge I love this book! The world is awash in Python introductions, but for the next step - from understanding Python in principle to using it in practical actual projects - there aren't so many good options, especially ones that keep an empathic learning curve。You can really see the experience the author brings from all of his teaching, paying excellent attention to what trips them up and to what common materials forget to teach。 He's avoided the "curse of knowledge" that makes too many experts forget what not yet knowing was like。 (disclaimer: Al is a friend and I got a slightly advance PDF from him, but I'm scrupulous about honesty in evaluation) 。。。more